Skip to content

refactor: Rename tests/ to e2e/ and migrate to .spec.ts (#3288)#3289

Merged
KATO-Hiro merged 3 commits into
stagingfrom
#3288
Mar 20, 2026
Merged

refactor: Rename tests/ to e2e/ and migrate to .spec.ts (#3288)#3289
KATO-Hiro merged 3 commits into
stagingfrom
#3288

Conversation

@KATO-Hiro
Copy link
Copy Markdown
Collaborator

@KATO-Hiro KATO-Hiro commented Mar 20, 2026

close #3288

Summary by CodeRabbit

  • Chores

    • Test infrastructure reorganized: integration-style tests are now recognized and run as end-to-end (E2E) tests.
    • Default test command updated to invoke the E2E suite.
    • Test discovery tightened to require the .spec.ts naming convention and look in the E2E test directory.
    • Removed unused/obsolete configuration blocks from the test runner settings.
  • Documentation

    • Updated docs and guides to reflect the new E2E paths and commands.

KATO-Hiro and others added 2 commits March 20, 2026 01:48
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Move all E2E tests from tests/ to e2e/, renaming files to snake_case .spec.ts
- Update playwright.config.ts: testDir, testMatch (spec only), remove dead commented blocks
- Rename package.json script test:integration → test:e2e
- Update AGENTS.md, .claude/rules/testing.md, docs, CI workflow accordingly

Closes #3288

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 06321224-5f2b-4f63-baeb-04c99b7622e4

📥 Commits

Reviewing files that changed from the base of the PR and between 0e5ce6a and ee1bdf0.

📒 Files selected for processing (1)
  • docs/guides/claude-code.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/guides/claude-code.md

Walkthrough

E2E test configuration, scripts, and docs were updated to use an e2e/ directory and require .spec.ts filenames; npm script and CI references renamed from test:integrationtest:e2e; Playwright config adjusted to discover e2e and match only *.spec.ts tests.

Changes

Cohort / File(s) Summary
Playwright & npm scripts
playwright.config.ts, package.json
Changed Playwright testDir from testse2e, tightened testMatch to only spec files, removed commented unused project blocks; renamed npm script test:integrationtest:e2e and updated test to run test:e2e first.
Documentation & rules
.claude/rules/testing.md, AGENTS.md, docs/guides/architecture.md, docs/guides/claude-code.md
Replaced references to tests/ with e2e/, added requirement that E2E files use .spec.ts, updated documented test command to pnpm test:e2e, and removed prior guidance to use @quramy/prisma-fabbrica in Playwright global setup.
CI / instructions
.github/workflows/ci.yml, .claude/skills/session-close/instructions.md
Updated commented/disabled CI step and session-close instructions to reference pnpm test:e2e instead of pnpm test:integration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through configs, tidy and quick,
Switched to e2e/ and .spec.ts for the pick,
Scripts and docs now sing in one tune,
Playwright finds tests beneath the same moon 🥕✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main changes: renaming the tests/ directory to e2e/ and migrating to .spec.ts file extension.
Linked Issues check ✅ Passed All changes directly address issue #3288 objectives: the E2E test directory was renamed from tests/ to e2e/, test file extensions were standardized to .spec.ts, and all related documentation and configuration files were updated accordingly.
Out of Scope Changes check ✅ Passed All changes are in scope: they support the stated objectives of renaming the E2E test directory and standardizing file extensions. No unrelated modifications were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch #3288
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
playwright.config.ts (1)

16-16: Matcher is broader than the documented .spec.ts convention.

Line 16 currently matches both .spec.ts and .spec.js. If the project standard is strictly .spec.ts, tighten this regex to enforce it.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@playwright.config.ts` at line 16, The testMatch pattern in
playwright.config.ts (symbol: testMatch) is too broad—/((.+\.)?spec\.[jt]s)/—and
currently allows .spec.js files; replace it with a stricter regex that only
matches TypeScript spec files (e.g., ensure the pattern ends with .spec.ts) so
only .spec.ts tests are discovered and run.
.github/workflows/ci.yml (1)

65-67: Rename the commented step label to match the command.

Line 67 uses pnpm test:e2e, but Lines 65-66 still say “Integration test.” Renaming that label to “E2E test” would keep terminology consistent.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml around lines 65 - 67, Rename the commented GitHub
Actions step label from "Integration test" to "E2E test" so it matches the
command being run; update the commented block that currently shows the step name
and command (the lines containing the label "Integration test" and the command
"pnpm test:e2e") to use "E2E test" as the step name.
AGENTS.md (1)

74-74: Consider adding the E2E filename convention here too.

Line 74 is a key testing rule entrypoint; adding “E2E files use .spec.ts” would keep this file aligned with the testing rule doc.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` at line 74, Update the "Tests" bullet to explicitly state the E2E
filename convention by adding a short clause like "E2E files use `.spec.ts`" so
the testing rules include naming guidance; modify the existing Tests line (the
bullet that begins "**Tests**: Write tests before implementation (TDD). ...") to
append this convention after the Nock/DB mocking guidance, ensuring the sentence
reads clearly and keeps the existing guidance about using
`@quramy/prisma-fabbrica` only in `prisma/seed.ts`, mocking the DB with
`vi.mock('$lib/server/database', ...)`, and using Nock for HTTP mocking.
docs/guides/architecture.md (1)

176-181: Clarify heading scope for test asset locations.

Line 176 says common test assets remain in src/test/, while Line 180 lists root-level e2e/. Consider rewording the heading so it doesn’t imply e2e/ is inside src/test/.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/guides/architecture.md` around lines 176 - 181, 見出し「共通テスト資産は src/test/
に残す」が `E2E テスト(e2e/)` を列挙しているため e2e/ が src/test/
配下と誤解される可能性があります。見出しを「共通テスト資産の配置」や「共通テスト資産は src/test/ に配置(E2E はルートの
e2e/)」のように書き換え、行内で `src/test/` と `e2e/` のスコープを明示してください(参照: 見出しテキスト "共通テスト資産は
src/test/ に残す" と箇条書き項目 "E2E テスト(`e2e/`)" を修正)。
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/guides/claude-code.md`:
- Around line 45-49: Update the testing scope table entry for `testing.md` to
include the missing `**/*.spec.ts` pattern alongside `*.test.ts` and `e2e/**`;
locate the `testing.md` row in the table (the line showing `*.test.ts`,
`e2e/**`) and append or replace it so it reads something like `*.test.ts,
**/*.spec.ts, e2e/**` to accurately reflect the testing rule.

---

Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 65-67: Rename the commented GitHub Actions step label from
"Integration test" to "E2E test" so it matches the command being run; update the
commented block that currently shows the step name and command (the lines
containing the label "Integration test" and the command "pnpm test:e2e") to use
"E2E test" as the step name.

In `@AGENTS.md`:
- Line 74: Update the "Tests" bullet to explicitly state the E2E filename
convention by adding a short clause like "E2E files use `.spec.ts`" so the
testing rules include naming guidance; modify the existing Tests line (the
bullet that begins "**Tests**: Write tests before implementation (TDD). ...") to
append this convention after the Nock/DB mocking guidance, ensuring the sentence
reads clearly and keeps the existing guidance about using
`@quramy/prisma-fabbrica` only in `prisma/seed.ts`, mocking the DB with
`vi.mock('$lib/server/database', ...)`, and using Nock for HTTP mocking.

In `@docs/guides/architecture.md`:
- Around line 176-181: 見出し「共通テスト資産は src/test/ に残す」が `E2E テスト(e2e/)` を列挙しているため
e2e/ が src/test/ 配下と誤解される可能性があります。見出しを「共通テスト資産の配置」や「共通テスト資産は src/test/ に配置(E2E
はルートの e2e/)」のように書き換え、行内で `src/test/` と `e2e/` のスコープを明示してください(参照: 見出しテキスト
"共通テスト資産は src/test/ に残す" と箇条書き項目 "E2E テスト(`e2e/`)" を修正)。

In `@playwright.config.ts`:
- Line 16: The testMatch pattern in playwright.config.ts (symbol: testMatch) is
too broad—/((.+\.)?spec\.[jt]s)/—and currently allows .spec.js files; replace it
with a stricter regex that only matches TypeScript spec files (e.g., ensure the
pattern ends with .spec.ts) so only .spec.ts tests are discovered and run.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 064e3aed-0344-4d3c-b38a-5247a9ef70d5

📥 Commits

Reviewing files that changed from the base of the PR and between c85af54 and 0e5ce6a.

📒 Files selected for processing (19)
  • .claude/rules/testing.md
  • .claude/skills/session-close/instructions.md
  • .github/workflows/ci.yml
  • AGENTS.md
  • docs/guides/architecture.md
  • docs/guides/claude-code.md
  • e2e/about_page.spec.ts
  • e2e/custom_colors.spec.ts
  • e2e/dark_mode.spec.ts
  • e2e/helpers/auth.ts
  • e2e/navbar.spec.ts
  • e2e/robots.spec.ts
  • e2e/signin.spec.ts
  • e2e/sitemap.spec.ts
  • e2e/toppage.spec.ts
  • e2e/workbook_order.spec.ts
  • e2e/workbooks_list.spec.ts
  • package.json
  • playwright.config.ts

Comment thread docs/guides/claude-code.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator Author

@KATO-Hiro KATO-Hiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@KATO-Hiro KATO-Hiro merged commit 26117af into staging Mar 20, 2026
3 checks passed
@KATO-Hiro KATO-Hiro deleted the #3288 branch March 20, 2026 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Chore] E2E テストのディレクトリ名をe2eにファイル名をspecで統一しましょう

1 participant